package com.lcb.map;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;

/****
 * @Author:刘长柏
 * @Date: 2021-01-06 15:45
 * @Description:模拟插入map
 *****/
public class MapResizer implements Runnable {

    private static HashMap<Integer, Integer> map = new HashMap<Integer, Integer>(2);
    private static AtomicInteger atomicInteger = new AtomicInteger();

    public void run() {
        while (atomicInteger.get() < 100000) {
            map.put(atomicInteger.get(), atomicInteger.get());
            atomicInteger.incrementAndGet();
        }
    }
/*
    void transfer(Entry[] newTable, boolean rehash) {
        int newCapacity = newTable.length;
        for (Entry<K,V> e : table) {
            while(null != e) {
                Entry<K,V> next = e.next;
                if (rehash) {
                    e.hash = null == e.key ? 0 : hash(e.key);
                }
                int i = indexFor(e.hash, newCapacity);
                e.next = newTable[i];
                newTable[i] = e;
                e = next;
            }
        }
    }
 */
}
